package com.ecoolex.cms.system.api.graphql;

import com.ecoolex.framework.common.annotation.MethodCatchException;
import com.ecoolex.framework.common.pojo.Result;
import com.ecoolex.framework.modularize.api.auth.admin.AdminMemberAuthority;
import com.ecoolex.framework.modularize.api.auth.admin.AdminMemberPermit;
import com.ecoolex.framework.modularize.api.auth.annotation.AdminAuthoritativeRegister;
import com.ecoolex.framework.modularize.api.auth.annotation.AuthoritativeParamer;
import com.ecoolex.framework.modularize.api.auth.annotation.PlatformAuthoritativeRegister;
import com.ecoolex.framework.modularize.api.auth.annotation.UserAuthoritativeRegister;
import com.ecoolex.framework.modularize.api.auth.platform.PlatformMemberAuthority;
import com.ecoolex.framework.modularize.api.auth.platform.PlatformMemberPermit;
import com.ecoolex.framework.modularize.api.auth.user.ConsumerMemberAuthority;
import com.ecoolex.framework.modularize.api.auth.user.ConsumerMemberPermit;
import com.ecoolex.framework.web.api.graphql2.annotation.GraphQL2Module;
import com.ecoolex.framework.web.api.graphql2.annotation.QueryField;
import com.ecoolex.framework.web.api.graphql2.annotation.GraphQL2Module.Type;
import com.ecoolex.cms.system.api.core.ApiConstant;


/*
 * @AdminAuthRegister(parentKey=Constant.AUTH_MODULE_KEY,
 * key=ApiConstant.AUTH_PROJECT_KEY,
 * name=ApiConstant.AUTH_PROJECT_NAME,
 * remark=ApiConstant.AUTH_PROJECT_REMARK)
 */
@GraphQL2Module(type = Type.User, description = "CMS系统")
public class ApiCoreGraphql {

	@QueryField(field = "check", description = "系统检查")
	public Result check() {
		return Result.createSuccessful();
	}

	// @QueryField(field = "checkUserAuth")
	// @UserAuthRegister(parentKey = Constant.AUTH_MODULE_KEY, key = "CHECK_USER_AUTH", name = "检查用户权限")
	// @AuthParam(key = "USER_NAME", remark = "创建用户", values = { AuthParam.ALL }, defaultValue = AuthParam.ALL)\
	// public Result checkUserAuth(UserAuthUser user) {
	// // 鉴权，无权限抛出异常
	// UserPermit permit = user.assertAuth("CHECK_ADMIN_AUTH");
	// // 参数鉴权, 鉴定参数是否具有权限
	// permit.parameter("ADMIN_USER_NAME").assertAuth(user.userName());
	// return Result.createSuccessful();
	// }
	//
	// @QueryField(field = "checkAdminAuth")
	// @AdminAuthRegister(parentKey = Constant.AUTH_MODULE_KEY, key = "CHECK_ADMIN_AUTH", name = "检查管理权限")
	// @AuthParam(key = "ADMIN_USER_NAME", remark = "创建用户", values = { AuthParam.ALL }, defaultValue = AuthParam.ALL)
	// @MethodCatchException
	// public Result checkAdminAuth(AdminAuthUser user) {
	// // 鉴权，无权限抛出异常
	// AdminPermit permit = user.assertAuth("CHECK_ADMIN_AUTH");
	// // 参数鉴权, 鉴定参数是否具有权限
	// permit.parameter("ADMIN_USER_NAME").assertAuth(user.userName());
	// return Result.createSuccessful();
	// }
	//
	// @QueryField(field = "checkPlatformAuth")
	// @PlatformAuthRegister(parentKey = Constant.AUTH_MODULE_KEY, key = "CHECK_PLATFORM_AUTH", name = "检查平台权限")
	// @AuthParam(key = "PLATFORM_USER_NAME", remark = "创建用户", values = { AuthParam.ALL }, defaultValue = AuthParam.ALL)
	// @MethodCatchException
	// public Result checkPlatformAuth(PlatformAuthUser user) {
	// // 鉴权，无权限抛出异常
	// PlatformPermit permit = user.assertAuth("CHECK_ADMIN_AUTH");
	// // 参数鉴权, 鉴定参数是否具有权限
	// permit.parameter("ADMIN_USER_NAME").assertAuth(user.userName());
	// return Result.createSuccessful();
	// }
}
